<template>
	<view class="content">
		<view class="info-block">
			<view class="title">{{info.title}}</view>
			<view class="time">{{info.createTime}}</view>
			<mp-html :content="info.content"></mp-html>
		</view>
		<!-- 1234567489 -->
		<!-- <view class="count-down">
			<image src="/static/images/shopping/species.png" class="img"></image>
			<view class="count">
				<view class="progress-bar">
					<div class="g-progress"></div>
				</view>
				<view class="seconds">{{ sec }}s后积分+10</view>
			</view>
		</view> -->
	</view>
</template>

<script>
	import {
		getLearnByIdApi
	} from '@/api/learn.js'
	export default {
		data() {
			return {
				id: null,
				tip: {
					time: '',
					count: 110
				},
				info: {
					id: 1,
					title: '',
					createTime: '',
					content: ''
				},
			}
		},
		mounted() {

		},
		methods: {
			navigate(url) {
				uni.navigateTo({
					url
				})
			},
			getDetails() {
				uni.showLoading({
					title: '加载中',
					mask: true
				})
				getLearnByIdApi({
					id: this.id
				}).then(res => {
					uni.hideLoading()
					this.info = res
				}).catch(() => {
					uni.hideLoading()
				})
			},
		},
		onLoad(e) {
			this.id = e.id
			this.getDetails()
		}
	}
</script>

<style lang="scss" scoped>
	.content {
		width: 100%;
		padding: 30rpx;

		.top-block {
			background: #CADFFA;
			padding: 30rpx;
			border-radius: 20rpx;

			.time {
				margin-bottom: 20rpx;
			}
		}

		.info-block {
			width: 100%;
			margin-top: 30rpx;
			background: #fff;
			padding: 30rpx;
			min-height: 70vh;
			border-radius: 20rpx;

			.title {
				font-size: 36rpx;
				font-weight: bold;
				margin-bottom: 30rpx;
			}

			.time {
				margin-bottom: 30rpx;
				color: #747474;
				font-size: 30rpx;
			}
		}

		.count-down {
			position: fixed;
			left: 6%;
			bottom: 8%;
			display: flex;
			flex-direction: column;
			align-items: center;
			justify-content: center;
			width: 230rpx;

			// background-color: greenyellow;
			.img {
				width: 220rpx;
				height: 150rpx;
			}

			.count {
				border-radius: 20rpx;
				text-align: center;
				background: rgba(0, 0, 0, 0.7);
				padding: 5rpx 14rpx;

				.progress-bar {
					width: 190rpx;
					height: 20rpx;
					background-color: #000;
					border-radius: 20rpx;
					margin: 10rpx;

					.g-progress {
						width: 30%;
						height: 20rpx;
						background-color: #FFC200;
						border-radius: 20rpx;
						//d transition: width 2s linear 1s;
					}
				}

				.seconds {
					font-size: 28rpx;
					color: #fff;
					margin-bottom: 10rpx;
				}
			}
		}
	}
</style>